home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_force_speed.cog < prev    next >
Text File  |  1998-02-25  |  3KB  |  143 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # FORCE_SPEED.COG
  4. #
  5. # FORCEPOWER Script - Speed
  6. #  Basic Power
  7. #  Bin 22
  8. #
  9. # [YB]
  10. #
  11. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  12.  
  13.  
  14. symbols
  15.  
  16. thing       player                           local
  17. flex        cost=20.0                        local
  18. flex        mana                             local
  19. flex        speed=0.0                        local
  20. int         rank=0                           local
  21.  
  22. sound       speedSound=ForceSpeed01.WAV      local
  23. sound       speedSound2=ForceSpeed02.WAV     local
  24. int         channel=-1                       local
  25.  
  26. int         inbubble=0                       local
  27.  
  28. message     startup
  29. message     timer
  30. message     activated
  31. message     newplayer
  32. message     killed
  33. message     selected
  34. message     enterbubble
  35. message     exitbubble
  36.  
  37. end
  38.  
  39. # ========================================================================================
  40.  
  41. code
  42.  
  43. startup:
  44.    player = GetLocalPlayerThing();
  45.    inbubble = 0;
  46.    call stop_power;
  47.  
  48.    Return;
  49.  
  50. # ........................................................................................
  51.  
  52. activated:
  53.    if(inbubble) Return;
  54.  
  55.    if(!IsInvActivated(player, 22))
  56.    {
  57.       mana = GetInv(player, 14);
  58.       if(mana >= cost || GetInv(player, 14) >= GetInv(player, 69))
  59.       {
  60.          if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
  61.  
  62.          // Send a "force disturbance"...
  63.          if(!IsMulti())
  64.             SendMessageExRadius(GetThingPos(player), cost, 0x4, splash, 22, 0, 0, 0);
  65.  
  66.          rank = GetInv(player, 22);
  67.          SetInvActivated(player, 22, 1);
  68.  
  69.          PlayMode(player, 24);
  70.  
  71.          // Play activation sound
  72.          PlaySoundThing(speedSound, player, 1.0, -1, -1, 0x80);
  73.  
  74.          // Play loop sound at 0.0 volume and fade it in to 1.0 volume in 0.75 secs
  75.          channel = PlaySoundThing(speedSound2, player, 0.0, -1, -1, 0x81);
  76.          ChangeSoundVol(channel, 1.0, 0.75);
  77.  
  78.          SetActorExtraSpeed(player, 0.5 + rank / 2);
  79.          SetTimer(5 + rank * 2.5);
  80.       }
  81.    }
  82.  
  83.    Return;
  84.  
  85. # ........................................................................................
  86.  
  87. timer:
  88.    if(channel != -1)
  89.    {
  90.       ChangeSoundPitch(channel, 0.05, 0.75);
  91.       Sleep(0.75);
  92.    }
  93.    call stop_power;
  94.  
  95.    Return;
  96.  
  97. # ........................................................................................
  98.  
  99. selected:
  100.    jkPrintUNIString(player, 22);
  101.    Return;
  102.  
  103. # ........................................................................................
  104.  
  105. killed:
  106.    if(GetSenderRef() != player) Return;
  107.  
  108. newplayer:
  109.    call stop_power;
  110.    Return;
  111.  
  112. # ........................................................................................
  113.  
  114. enterbubble:
  115.    inbubble = 1;
  116.    call stop_power;
  117.    Return;
  118.  
  119. # ........................................................................................
  120.  
  121. exitbubble:
  122.    inbubble = 0;
  123.    Return;
  124.  
  125. # ........................................................................................
  126.  
  127. stop_power:
  128.    if(channel != -1)
  129.    {
  130.       StopSound(channel, 0.1);
  131.       channel = -1;
  132.    }
  133.    SetPulse(0);
  134.    SetInvActivated(player, 22, 0);
  135.    SetActorExtraSpeed(player, 0);
  136.  
  137.    Return;
  138.  
  139. end
  140.  
  141.  
  142.  
  143.